using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace Gko.Utils
{
	internal class ReaderWriterLockSlim : DisposableBase
	{
		private readonly object read = new object();
		private readonly object write = new object();

		public void EnterWriteLock()
		{
			Monitor.Enter(this.read);
			Monitor.Enter(this.write);
		}

		public void ExitWriteLock()
		{
			Monitor.Exit(this.write);
			Monitor.Exit(this.read);
		}

		public void EnterReadLock()
		{
			Monitor.Enter(this.read);
		}

		public void ExitReadLock()
		{
			Monitor.Exit(this.read);
		}
	}
}
